<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSalesmanSet extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('salesman_set', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('cityid')->comment('城市id');
            $table->string('name', 128)->comment('名称');
            $table->string('salesmantype')->comment('商家地推、个人地推');
            $table->string('shoptype')->default('')->comment('商家普通地推，合伙人地推');
            $table->integer('accountperiod')->default(1)->comment('结算周期，单位为月');
            $table->string('accountperioddescription', 128)->default('')->comment('结算周期描述');
            $table->integer('validsalesmanruletype')->default(1)->comment('有效地推类型');
            $table->integer('validorderminnum')->default(1)->comment('多少笔订单才算有效用户');
            $table->decimal('validorderminamount', 6, 2)->default(0.00)->comment('每笔订单多少金额才算有效用户');
            $table->integer('accounttype')->default(1)->comment('结算类型');
            $table->decimal('registergetmoney', 6, 2)->default(0.00)->comment('注册一个获取金额');
            $table->decimal('accountorderminamount', 6, 2)->default(0.00)->comment('订单最少金额才给钱');
            $table->decimal('ordergetmoney', 6, 2)->default(0.00)->comment('每笔订单获取金额');
            $table->decimal('ordergetratio', 6, 2)->default(0.00)->comment('每笔订单获取比例');
            $table->integer('topnum')->default(0)->comment('前多少名注册数');
            $table->decimal('topregistergetmoney',6,2)->default(0.00)->comment('前多少名单个注册获取金额');
            $table->decimal('topordergetratio', 6, 2)->default(0.00)->comment('前多少名订单获取比例');
            $table->decimal('afterregistergetmoney', 6, 2)->default(0.00)->comment('之后单个注册获取金额');
            $table->decimal('afterordergetratio')->default(0.00)->comment('之后订单获取比例');

            $table->integer('rechargetopnum')->default(0)->comment('充值前多少笔');
            $table->decimal('rechargeminamount')->default(0.00)->comment('充值最小金额');
            $table->decimal('rechargegetmoney')->default(0.00)->comment('充值获取金额');

            $table->tinyInteger('status')->default(1)->comment('状态');
            $table->integer('adminid')->default(0)->comment('操作人id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
